<!--
 * @Author: 田鑫
 * @Date: 2023-03-05 15:13:44
 * @LastEditors: 田鑫
 * @LastEditTime: 2023-03-05 15:43:18
 * @Description: 模拟登录鉴权页
-->

<template>
  <a-modal title="登录鉴权页" :visible="true" :footer="false">
    <div w100 align-center>
      <a-button w-160 @click="login" :loading="loading" type="primary">登录</a-button>
    </div>
  </a-modal>
</template>

<script  lang="ts" setup>
const route = useRoute();
const router = useRouter();
const loading = ref(false);

function login() {
  loading.value = true;
  localStorage.setItem('satoken', '123asdzxc');
  AMessage.success('登录鉴权成功，准备跳转');
  setTimeout(() => {
    loading.value = false;
    router.push({ name: route.query?.redirect ? route.query?.redirect : 'dashboard' });
  }, 1500);
}
</script>

<style lang="less" scoped>
</style>